﻿@model Weibo.Web.Models.FollowListModel
@{
    Group g = null;

    if (Model.gid>0)
    {
        g = Groups.GetGroupByID(Model.gid);
    }
    IList<Group> allGroups = Groups.GetGroupsByUID(Model.CurUser.ID);
    IList<Group> barGroups = null;
    IList<Group> popListGroups = null;
}
 @{
     Layout = "~/Views/Shared/_Layout.cshtml";
 }
 @{
     ViewBag.Title = "我关注的人 XX微博-随时随地分享身边的新鲜事儿";
 }

    @section  cssInsert{
    <link href="/Content/CSS/connect.css" type="text/css" rel="stylesheet">
    }
    @section  jsInsert{
    <script src="/Scripts/Friend.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
         App.initNameCard($("#att_wrap"));
        App.TimerFunArray.push(App.autoCompleteTimerEvent);
        App.TimerFunArray.push(App.ajaxAtWho);
        App.StartTimer();
            App.FriendManage.initFollowAssignBox();
            $("#add_group").click(function () {
                App.popGroupDiv();
            });
            var searchBox=$("#fans_and_follow_filter_input").JQP_HighLineInput2({nullCon:"输入昵称或备注"}).keyup(function(e){
               if(e.which==13){
                   window.location.href="/Follow/Search?Key="+encodeURIComponent($.trim(this.value));
               }
            });
             App.autoComplete(searchBox, function (id, name) {
                window.location.href="/Follow/Search?Key="+encodeURIComponent(name);
             },"GetFollowListByKey");
             $("#fans_and_follow_filter_submit").click(function(){
                
             if(searchBox.val()=="输入昵称或备注")
             return false;
             else{
             window.location.href="/Follow/Search?Key="+encodeURIComponent($.trim(searchBox.val()));
             }
             });
            @{
             DataContractJsonSerializer s;
                if(allGroups!=null)
                {
                    s= new DataContractJsonSerializer(allGroups.GetType());
                    using (MemoryStream ms = new MemoryStream())
                    {
                        s.WriteObject(ms, allGroups);
                @:App.FriendManage.groupList=@MvcHtmlString.Create(System.Text.Encoding.UTF8.GetString(ms.ToArray()));
            }
            }
                    if (g != null)
                {
                    s = new DataContractJsonSerializer(g.GetType());
                    using (MemoryStream ms = new MemoryStream())
                    {
                        s.WriteObject(ms, g);
                @:App.FriendManage.curGroup=@MvcHtmlString.Create(System.Text.Encoding.UTF8.GetString(ms.ToArray()));
                @:$("#update_group").click(function(){
             @:    App.popGroupDiv(App.FriendManage.curGroup.ID,App.FriendManage.curGroup.Name);
            @:});    
                }
            }    
            }
            
        });
    </script>
    }

            <div class="MIB_blogbody">
                <div class="MIB_mblogbgr ">
                    <div class="MIB_mblogbgl">
                        <!--右栏内容 -->
                        <div class="mainR MIB_200 MIB_txtar MIB_linkar">
                            @RenderPage("~/Views/Shared/_FollowRightNav.cshtml")
                        </div>
                        <!--/右栏内容 -->
                        <!--左栏内容 -->
                        <div class="mainL MIB_600 MIB_txtal MIB_linkal">
                            <div class="cetSearch">
                                <!-- 我的粉丝和关注页 -->
                                <!--评论区 -->
                                <div class="btmTit_wrap csTitle">
                                    <div class="lf">
                                        我关注了@{@Model.CurUser.FocusCount}
                                        人
                                    </div>
                                    <div class="rt">
                                        <label>
                                            <input style="color: rgb(153, 153, 153);" maxlength="20" class="txt_s1" id="fans_and_follow_filter_input"
                                                value="输入昵称或备注" type="text">
                                            <a href="#" class="btn_normal btnxs" id="fans_and_follow_filter_submit"><em>搜索</em></a>
                                        </label>
                                    </div>
                                </div>
                                <!--/评论区 -->
                                <div class="newFilter MIB_txtal">
                                    <!--头部分组导航-->
                                    <div class="nfTagB nfTagOn clearFix">
                                        <ul id="group_list">
                                            @{
                                              
                                                if (g != null)
                                                {
                                                <li><a href="/@Model.CurUser.ID/Follow">全部</a></li>
                                                <li class="MIB_line_l">|</li>
                                                <li><a href="/@Model.CurUser.ID/Follow?FriendShip=1">互相关注</a></li>
                                                <li class="MIB_line_l">|</li>
                                                <li><a href="/@Model.CurUser.ID/Follow?NoGroup=1">未分组</a></li>
                                                <li class="MIB_line_l">|</li>
                                                }
                                                else if (Model.FriendShip>0)
                                                { 
                                                <li><a href="/@Model.CurUser.ID/Follow">全部</a></li>
                                                <li class="MIB_line_l">|</li>
                                                <li class="current" id="current_group"><a href="#">互相关注</a></li>
                                                <li><a href="/@Model.CurUser.ID/Follow?NoGroup=1">未分组</a></li>
                                                <li class="MIB_line_l">|</li>
                                                }
                                                else if (Model.NoGroup >0)
                                                { 
                                                <li><a href="/@Model.CurUser.ID/Follow">全部</a></li>
                                                <li class="MIB_line_l">|</li>
                                                <li><a href="/@Model.CurUser.ID/Follow?FriendShip=1">互相关注</a></li>
                                                <li class="MIB_line_l">|</li>
                                                <li class="current" id="current_group"><a href="#">未分组</a></li>
                                                }
                                                else
                                                {
                                                <li class="current" id="current_group"><a href="#">全部</a></li>	
                                                <li><a href="/@Model.CurUser.ID/Follow?FriendShip=1">互相关注</a></li>
                                                <li class="MIB_line_l">|</li>
                                                <li><a href="/@Model.CurUser.ID/Follow?NoGroup=1">未分组</a></li>
                                                <li class="MIB_line_l">|</li>
                                                }
                                                if (allGroups != null && allGroups.Count > 3)
                                                {
                                                    barGroups = new List<Group>();
                                                    popListGroups = new List<Group>();
                                                    for (int i = 0; i < allGroups.Count; i++)
                                                    {
                                                        if (g != null && allGroups[i].ID == g.ID && i >= 3)
                                                        {

                                                            Group tmp = barGroups[2];

                                                            barGroups[2] = g;

                                                            popListGroups.Insert(0, tmp);
                                                        }

                                                        else
                                                        {

                                                            if (i < 3)
                                                            {

                                                                barGroups.Add(allGroups[i]);

                                                            }

                                                            else
                                                            {

                                                                popListGroups.Add(allGroups[i]);

                                                            }

                                                        }
                                                    }
                                                }
                                                else if (allGroups != null && allGroups.Count <= 3)
                                                {
                                                    barGroups = new List<Group>();
                                                    for (int i = 0; i < allGroups.Count; i++)
                                                    {
                                                        barGroups.Add(allGroups[i]);
                                                    }
                                                }
                                                if (barGroups != null)
                                                {
                                                    for (int i = 0; i < barGroups.Count; i++)
                                                    {
                                                        if (g != null && barGroups[i].ID == g.ID)
                                                        {
												 
                                                <li class="current" id="current_group"><a href="/@Model.CurUser.ID/Follow?gid=@g.ID"
												title="@g.Name">@g.Name</a></li>
                                                        }
                                                        else
                                                        {
                                                <li><a href="/@Model.CurUser.ID/Follow?gid=@barGroups[i].ID" title="@barGroups[i].Name">@barGroups[i].Name</a></li>
                                                <li class="MIB_line_l">|</li>
                                                        }
                                                    }
                                                }
                                                if (popListGroups != null && popListGroups.Count > 0)
                                                {
                                                <li><a class="moreti" href="javascript:void(0)" id="attlistMore"><span class="txt">更多</span><span
                                                    class="more"></span></a></li>
                                                }
											
                                            }
                                        </ul>
                                        <a href="javascript:void(0)" id="add_group" class="newbtnadd">
                                            <img class="SG_icon" src="/Content/Image/transparent.gif" title="关注已选"><em>创建分组</em></a>
                                        <div class="clear">
                                        </div>
                                    </div>
                                    <!--/头部分组导航-->
                                    <!--未分组不显示以下头部-->
                                    <!--头部排序方式和单个分组导航-->
                                    @{
                                        if (g == null && Model.FriendShip==0 && Model.NoGroup ==0)
                                        {
                                        <div class="nfBox clearFix">
                                            <div class="chgz_tit">
                                                排序方式：</div>
                                            <ul class="chgz_tag">
                                                <li class="@{@(Model.OrderBy == "CreateTime" ? "current" : "")}"><a @{@(Model.OrderBy == "CreateTime" ? "" : "href=/"+Model.CurUser.ID+"/Follow?OrderBy=CreateTime")} class="btn_chBlue">
                                                    <em>关注时间</em></a></li>
                                                <li class="@{@(Model.OrderBy == "LastUpdateDate" ? "current" : "")}">
                                                    <a @{@(Model.OrderBy == "LastUpdateDate" ? "" : "href=/" + Model.CurUser.ID + "/Follow?OrderBy=LastUpdateDate")} 
												class="btn_chBlue"><em>最近更新</em></a></li>
                                                <li class="@{@(Model.OrderBy == "LastContactTime" ? "current" : "")}">
                                                    <a @{@(Model.OrderBy == "LastContactTime" ? "" : "href=/" + Model.CurUser.ID + "/Follow?OrderBy=LastContactTime")} 
												class="btn_chBlue"><em>最近联系</em></a></li>
                                                <li class="@{@(Model.OrderBy == "FocusedCount" ? "current" : "")}">
                                                    <a @{@(Model.OrderBy == "FocusedCount" ? "" : "href=/" + Model.CurUser.ID + "/Follow?OrderBy=FocusedCount")} 
												class="btn_chBlue"><em>粉丝数</em></a></li>
                                            </ul>
                                        </div>
                                        }
                                        if (g != null)
                                        {
                                        <div class="nfBox clearFix">
                                            <div class="chgz_list">
                                                <span class="p_nolik">
                                                    <img src="/Content/Image/transparent.gif" class="small_icon male" title=""><span>该分组共<em>@Model.RecordCount</em>人</span></span>
                                                <a gid="@g.ID" id="update_group" href="javascript:void(0);">
                                                    <img src="/Content/Image/transparent.gif" class="chgzicon ci1" title=""><span>修改分组名称</span></a><a onclick="App.FriendManage.delGroup(this, @g.ID);return false;" href="javascript:void(0);" id="delete_group"><img
                                                        src="/Content/Image/transparent.gif" class="chgzicon ci2" title=""><span>删掉该分组</span></a><a href="/@(string.IsNullOrEmpty(Model.CurUser.CustomSite) ? Model.CurUser.ID.ToString() : Model.CurUser.CustomSite)?gid=@g.ID"><img
                                                            src="/Content/Image/transparent.gif" class="chgzicon ci3" title=""><span>浏览该分组微博</span></a>
                                            </div>
                                        </div>
                                        }
                                        if (Model.FriendShip>0)
                                        {
                                        <div class="nfBox clearFix">
                                            <div class="chgz_list">
                                                <span class="p_nolik">
                                                    <img src="/Content/Image/transparent.gif" class="small_icon male" title=""><span>互相关注<em>@Model.RecordCount</em>人</span>
                                                </span>
                                            </div>
                                        </div>
                                        }
                                    }
                                    <!--/头部排序方式和单个分组导航-->
                                </div>
                                <!--内容区 -->
                                <!--排序-->
                                <div id="system_information" style="display: none">
                                </div>
                                <div class="clear">
                                </div>
                                @{
                                    if (g != null)
                                    {
                                    <div class="recom_form1">
                                        <!--/分组关注头部-->
                                        <div class="recom_row">
                                            <div class="lf lftxt">
                                                将关注人添加到分组：</div>
                                            <div class="rem_ip">
                                                <div class="nowd_input lf">
                                                    <div style="float: left; margin-right: 8px; width: 300px;">
                                                        <a class="arrowup" href="javascript:void(0);"></a>
                                                        <ul class="tagList" style="width: 292px;">
                                                            <li style="height: 20px; float: left; z-index: 1200;">
                                                                <input type="text" style="width: 6px;"></li></ul>
                                                    </div>
                                                    <input type="text" style="width: 201px; color: rgb(153, 153, 153); display: none;"
                                                        name="idder" id="group_member_add_input">
                                                </div>
                                                &nbsp;&nbsp;<a class="btn_normal btnxs" id="group_member_add_btton" href="javascript:void(0);"><em>添加</em></a>
                                            </div>
                                        </div>
                                    </div>
                                    }
                                }
                                <!--/排序-->
                                <!-- /我的粉丝关注页结束 -->
                                <!-- 他人的粉丝关注页 -->
                                <!-- /他人的粉丝关注页 -->
                                <div class="box_gr1">
                                    <ul class="concernBox" id="att_wrap" popcontainer="true">
                                        @{
                                            if (Model.Follows != null)
                                            {
                                                foreach (Follow follow in Model.Follows)
                                                {
                                            <li class="MIB_linedot_l" onmouseover="App.showExtendBtn(this);" onmouseout="App.hideExtendBtn(this);"
											id="@follow.ID">
                                                <div class="conBox_l">
                                                    <a href="/@follow.ID" uid="@follow.ID" namecard="true" uname="@follow.NickName" >
                                                        <img title="@follow.NickName"  src="@follow.MidAvartar"></a></div>
                                                <div class="conBox_c">
                                                    <span class="name"><a uid="@follow.ID" namecard="true" uname="@follow.NickName" href="/@follow.ID" title="@follow.NickName">@follow.NickName</a>
                                                        <span extend="true" class="remark" id="remark_@{@follow.ID;}" style=" visibility:hidden">
                                                            (<a href="javascript:void(0);" onclick="App.showEditRemarkBox (this,'@follow.ID');return false;">@{@(string.IsNullOrEmpty(follow.Remark) ? "设置备注" : follow.Remark)}</a>)</span></span>
                                                    <p class="address">
                                                        <img src="/Content/Image/transparent.gif" class="small_icon @{@(follow.Sex ==TypeConfigs.GetSexFemale ? "sicon_female" : "man")}" title="@{@(follow.Sex == TypeConfigs.GetSexFemale ? "女" : "男")}">@{@Types.GetCityTypesFullName(follow.Location);}
                                                        <span>粉丝<strong>@follow.FocusedCount</strong>人</span></p>
                                                    <div class="content MIB_linkbl">
                                                        <a href="/@follow.ID" class="ms">
                                                            @{@follow.LastMContent}
                                                            (@{@(follow.LastUpdateDate != null ? DateSpan.Get(follow.LastUpdateDate.Value) : "未知")})</a>
                                                    </div>
                                                    <div class="roommate">
                                                        <a title="@Groups.GetGroupsString(follow.GroupIDs, allGroups, 14)" class="btn_privacy" action="groupselector" personid="@follow.ID" groupids="@follow.GroupIDs"
														href="javascript:void(0);"><em>@Groups.GetGroupsString(follow.GroupIDs, allGroups, 14)<img
                                                            src="/Content/Image/transparent.gif" class="small_icon down_arrow"></em></a>
                                                    </div>
                                                </div>
                                                <div class="conBox_r ">
                                                    @{
                                        if (follow.FriendShip == 1)
                                        {
                                                        <p class="mutual">
                                                            <img class="small_icon sicon_atteo" title="互相关注中" src="/Content/Image/transparent.gif"></p>
                                        }
                                                    }
                                                    <p extend="true" style="visibility:hidden" id="cancel_@{@follow.ID}">
                                                        <a href="javascript:void(0);" onclick="App.FriendManage.cancelFollow (@follow.ID,'@follow.NickName',this);return false;">
                                                            取消关注</a></p>
                                                </div>
                                                <div class="clearit">
                                                </div>
                                            </li>
                                                }
                                            }
                                        }
                                    </ul>
                                </div>
                                <div class="MIB_bobar">
                                    <!--返回顶部-->
                                    <div class="ftop lf">
                                        <a href="#">
                                            <img title="返回顶部" src="/Content/Image/transparent.gif" class="small_icon returntop">返回顶部</a>
                                    </div>
                                    <!--返回顶部-->
                                    <!--翻页-->
                                    @Html.Pager(Model.Page, Model.RecordCount, Model.PageSize)
                                    <!--翻页-->
                                </div>
                                <!--/内容区 -->
                            </div>
                        </div>
                        <!--/左栏内容 -->
                    </div>
                </div>
            </div>

 @section  conSupplement{
    <div class="nfTaglay" style="z-index: 99; position: absolute; display: none;">
        <ul class="sltmenu_m">
            @{
                if (popListGroups != null)
                {
                    for (int i = 0; i < popListGroups.Count; i++)
                    {
                <li class="txt"><a href="/@Model.CurUser.ID/Follow?gid=@popListGroups[i].ID">@popListGroups[i].Name</a></li>
                    }
                }
            }
        </ul>
    </div>
    <script type="text/javascript">
        var btnMore = $(".moreti");
        var groupList = $(".nfTaglay");
        App.lazyEvent(btnMore, "mouseenter", "mouseleave", 500, function () {
            groupList.css("left", $(btnMore).offset().left).css("top", $(btnMore).offset().top + 25).show()
        }, function () {
            App.lazyFunction(function () { groupList.hide(); }, 500)
        });
        App.lazyEvent(groupList, "mouseleave", "mouseenter", 500, function () {
            groupList.hide();
        });
    </script>
    <div class="cetdowme" curUid="" style="position: absolute; z-index: 800;display:none;">
        @{
            if (allGroups != null)
            {
                for (int i = 0; i < allGroups.Count; i++)
                {
            <p sel="1">
                <input type="checkbox" class="labelbox" id="group_selector_item_@{@allGroups[i].ID}" /><label for="group_selector_item_@{@allGroups[i].ID}" title="@{@allGroups[i].Name}">@{@allGroups[i].Name}
                </label>
            </p>
                }
            }
        }
        <div class="MIB_linedot1">
        </div>
        <p>
            <a id="gcBtn" href="javascript:void(0);">创建新分组 </a>
        </p>
        <p class="opt" style="display: none;">
            <input type="text" />
        </p>
        <span class="error_color" style="display: none;">请不要超过8个汉字 </span>
        <p class="btn" style="display: none;">
            <a class="btn_normal btnxs" href="javascript:void(0);"><em>保存</em> </a><a class="btn_normal btnxs"
                href="javascript:void(0);"><em>取消</em> </a>
        </p>
    </div>
    <script type="text/javascript">
        App.FriendManage.initGroupSelector();
    </script>
    }

